package com.gerfmarquez.nymph.ui.listeners;

import android.app.AlertDialog;
import android.content.Context;
import android.util.Log;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.View;
import android.widget.LinearLayout;

import com.gerfmarquez.nymph.ui.gesture.detectors.LongPressDetector;
import com.gerfmarquez.nymph.ui.seekbar.VerticalSeekBar;

public class SeekBarOnOnTouchListener implements View.OnTouchListener{
	
	GestureDetector gDLongPress;
	LongPressDetector longPressDetector;
	Context context;
	
	public SeekBarOnOnTouchListener(Context context) {
		longPressDetector = new LongPressDetector(context);
		gDLongPress = new GestureDetector(longPressDetector);
		this.context = context;
	}
		
		@Override
		public boolean onTouch(View verticalSeekBar, MotionEvent event) {
			if(gDLongPress.onTouchEvent(event)) {
				return true;
			} else {
				if(longPressDetector.isLongPressedCustom) {
					longPressDetector.isLongPressedCustom = false;
					
//					Log.d("OnTouchListenerSeekBar", "True Long press view id = "+indexChild);
					
			        CharSequence[] items = {"Add Music Note/s", "Remove Music Note/s", "Change Note Tone"};

			        AlertDialog.Builder builder = new AlertDialog.Builder(context);
			        builder.setTitle("Choose an action");
			        DialogListenerActionMusicNote dlam =  new DialogListenerActionMusicNote(context);
			        dlam.setVerticalSeekBar((VerticalSeekBar)verticalSeekBar);
			        builder.setItems(items,dlam);
			        AlertDialog alert = builder.create();
			        alert.show();
					

					return false;
				}
				else {
//					Log.d("OnTouchListenerSeekBar", "False Long PRess  view id = "+((VerticalSeekBar)verticalSeekBar).getIdVerticalSeekBar());
					return false;
				}
			}

	}
}
